<?php

/**
 * @author ducnhat
 * @copyright 2014
 */

add_action("admin_menu", "register_dn_theme_settings");

function register_dn_theme_settings(){
    add_menu_page("Theme Settings", "DN Theme Settings", "administrator", "dn-theme-settings", "dn_theme_settings_form");
    add_action("admin_init", "register_dn_settings");
}

function register_dn_settings(){
    register_setting("dn_theme_settings", "dn_facebook_account");
    register_setting("dn_theme_settings", "dn_company_name");
    register_setting("dn_theme_settings", "dn_company_description");
    register_setting("dn_theme_settings", "dn_company_address");
    register_setting("dn_theme_settings", "dn_company_email");
    register_setting("dn_theme_settings", "dn_company_phone_number");
    register_setting("dn_theme_settings", "dn_slogan");
}

function dn_theme_settings_form(){
    ?>
    <div class="wrap">
        <h2><?php echo _e("Theme Settings", "lskt"); ?></h2>
        <form action="options.php" method="post">
            <?php settings_fields("dn_theme_settings"); ?>
            <?php do_settings_sections("dn_theme_settings"); ?>
            <h3 class="title">
                <?php echo _e("Slogan", "lskt"); ?>
            </h3>
            <table class="form-table">
                <tr>
                    <th scope="row">
                        <?php echo _e("Slogan", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_slogan" value="<?php echo get_option("dn_slogan"); ?>" />
                    </td>
                </tr>
            </table>
            
            <h3 class="title">
                <?php echo _e("Social Accounts", "lskt"); ?>
            </h3>
            <table class="form-table">
                <tr>
                    <th scope="row">
                        <?php echo _e("Facebook account", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_facebook_account" value="<?php echo get_option("dn_facebook_account"); ?>" />
                    </td>
                </tr>
            </table>
            
            <h3 class="title">
                <?php echo _e("Contact Infomation", "lskt"); ?>
            </h3>
            <table class="form-table">
                <tr>
                    <th scope="row">
                        <?php echo _e("Name", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_company_name" value="<?php echo get_option("dn_company_name"); ?>" />
                    </td>
                </tr>
                
                <tr>
                    <th scope="row">
                        <?php echo _e("Address", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_company_address" value="<?php echo get_option("dn_company_address"); ?>" />
                    </td>
                </tr>
                
                <tr>
                    <th scope="row">
                        <?php echo _e("Email", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_company_email" value="<?php echo get_option("dn_company_email"); ?>" />
                    </td>
                </tr>
                
                <tr>
                    <th scope="row">
                        <?php echo _e("Phone Number", "lskt") ?>
                    </th>
                    
                    <td>
                        <input type="text" class="regular-text ltr" name="dn_company_phone_number" value="<?php echo get_option("dn_company_phone_number"); ?>" />
                    </td>
                </tr>
                
                <tr>
                    <th scope="row">
                        <?php echo _e("Description", "lskt") ?>
                    </th>
                    
                    <td>
                        <textarea class="regular-text ltr" cols="30" rows="3" name="dn_company_description"><?php echo get_option("dn_company_description"); ?></textarea>
                    </td>
                </tr>
            </table>
            <?php submit_button(); ?>
        </form>
    </div>
    <?php
}

?>